// CTgaLoader.h -- standard vector class
// *** Code "Borrowed" from www.UltimateGameProgramming.com

#ifndef CVECTOR_H_
#define CVECTOR_H_

#include <cmath>                                         // Math header file.
using namespace std;

class CVector3
{
   public:
      CVector3();                                        // Constructor.
      CVector3(float X, float Y, float Z);               // Overloaded constructor.
      CVector3(const CVector3 &v);                       // Another overloaded constructor.

      void operator=(CVector3 v);                        // Overloaded = sign.
      CVector3 operator-(CVector3 v);                    // Overloaded - sign.
      CVector3 operator+(CVector3 v);                    // Overloaded + sign.
      CVector3 operator*(CVector3 v);                    // Overloaded * sign.
      CVector3 operator/(CVector3 v);                    // Overloaded / sign.
      CVector3 operator+(float f);                       // Overloaded + sign.
      CVector3 operator-(float f);                       // Overloaded - sign.
      CVector3 operator*(float f);                       // Overloaded * sign.
      CVector3 operator/(float f);                       // Overloaded / sign.

      void operator +=(CVector3 v);                      // Overloaded += sign.
      void operator -=(CVector3 v);                      // Overloaded -= sign.
      void operator *=(CVector3 v);                      // Overloaded *= sign.
      void operator /=(CVector3 v);                      // Overloaded /= sign.
      void operator +=(float f);                         // Overloaded += sign.
      void operator -=(float f);                         // Overloaded -= sign.
      void operator *=(float f);                         // Overloaded *= sign.
      void operator /=(float f);                         // Overloaded /= sign.
      
      float &operator[](int index);
		float operator[](int index) const;

      bool operator ==(CVector3 v);                      // Overloaded == sign.
      bool operator !=(CVector3 v);                      // Overloaded != sign.

      void CrossProduct(CVector3 v1, CVector3 v2);       // Stores cross product of v1, v2.
      void CrossProduct3(CVector3 v1, CVector3 v2,
                         CVector3 v3);                   // Stores cross product of v1, v2, v3.
      float DotProduct3(CVector3 v1);                    // Dot 3 on v1 and this.
      float GetLength();                                 // Return this objects length.
      void Normal();                                     // Normalize this vector.
      void Normalize(CVector3 Triangle[]);               // Find the normal of a triangle.

      void ExtendVertexPos(CVector3 lightPos,            // Extend point based on light position
                           float Extend);                // and currend point, saves here.
      void ExtendVertexPos(CVector3 currentVertex,       // Takes current point and source and
                           CVector3 lightPos,            // extend and saves here.
                           float Extend);
      CVector3 GetRotatedAxis(double angle, CVector3 axis);// Rotate along an axis.
      void CalculateBinormalVector(CVector3 tangent,
                                   CVector3 normal);     // Calcluate a binormal.
      void ClampTo01();                                  // Clamp this vector between 0 and 1.

      float x, y, z;                                  // vertex's x, y, and z info.
};

#endif

